var $ = getApp(), methods = require("../methods.js");
Page(Object.assign({}, methods, {
	data: {
    type:'juli',
		longitude:'',
		latitude:'',
		datalist: [],
		pagenum: 1,
		keyword:'',
        cid:0,
        diqulist:[],
        showbox:false,
        id:0
	},
	_onLoad:function(){
		var that = this
		if(that.options && that.options.id){
			that.setData({id:that.options.id});
		}
        
		that.setData({ pagenum: 1, datalist: [], $nomoreData: false });
		that.getDataList();
	},
	getDataList: function () {
		var that = this
        var pagenum = that.data.pagenum;
        var id = that.data.id;
		that.setData({loaddingmore:true})
        $.post('yuxun/getyuhuolist', { pagenum: pagenum, id:id}, function (res) {
			that.setData({loaddingmore:false})
			var data = res.data
			if (pagenum == 1) {
				that.setData({ datalist: data });
				if (data.length == 0) {
					$.showEmpty('暂无相关数据！');
				}
			} else {
				if (data.length == 0) {
					that.setData({ $nomoreData: true });
				} else {
					var datalist = that.data.datalist
					var newdata = datalist.concat(data)
					that.setData({ datalist: newdata });
				}
			}
			that.setData({
				sclist: data
			});
		},false);
	},
	onReachBottom: function () {
		if (!this.data.$dataEmpty.visible && !this.data.$nomoreData) {
			this.setData({ pagenum: this.data.pagenum + 1 })
			this.getDataList();
		}
    }
}))